﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data.SqlClient;
using System.Collections;


namespace WFDatabase.Helpers
{
    static public class SqlConnectionExtension
    {
        static public object RetrieveStatistics(this SqlConnection sqlconnection,string key)
        {
            IDictionary dictionary = sqlconnection.RetrieveStatistics();
            if (key.Equals("All"))
            {
                ArrayList list = new ArrayList();
                foreach (DictionaryEntry item in dictionary)
                {
                    list.Add(string.Format("Name: {0} Value: {1}",item.Key,item.Value));
                }
                return list;
            }
            else
            {
                return dictionary[key];
            }
            
        }
    }
}
